package com.hz.ruoyifarmbase.farm.controller;

import com.hz.ruoyifarmbase.farm.domain.vo.AgrProcessOperateVo;
import com.hz.ruoyifarmbase.farm.service.AgrBaseProcessService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author 高铭月
 * @date 2025/3/5 16:58
 * @description:
 */
@RestController
@RequestMapping("/guide")
public class AgrBaseProcessController extends BaseController {
    @Autowired
    private AgrBaseProcessService agrBaseProcessService;
    /**
     * 获取种植流程列表
     */
    @RequiresPermissions("farm:guide:list")
    @GetMapping("/list")
    public AjaxResult listProcessByTypeId(@RequestParam Long typeId) {
        return success(agrBaseProcessService.getProcessByTypeId(typeId));
    }

    /**
     * 获取种植流程列表
     * @param typeId
     * @return
     */
    @RequiresPermissions("farm:guide:list")
    @GetMapping("/listByTypeIds")
    public AjaxResult listProcessByTypeIds(@RequestParam Long typeId) {
        return success(agrBaseProcessService.getProcessByTypeIds(typeId));
    }

    /**
     * 根据流程id获取流程信息
     * @param processId
     * @return
     */
    @RequiresPermissions("farm:guide:list")
    @GetMapping("/getProcessById")
    public AjaxResult listProcessByProcessId(@RequestParam Long processId) {
        return success(agrBaseProcessService.getProcessByProcessId(processId));
    }
    /**
     * 修改流程状态后修改地块批次状态信息
     * @param agrProcessOperateVo
     * @return
     */
    @RequiresPermissions("farm:guide:list")
    @PutMapping
    public AjaxResult updateProcess(@RequestBody AgrProcessOperateVo agrProcessOperateVo) {
        return success(agrBaseProcessService.update(agrProcessOperateVo));
    }


}
